package com.audiocn.manager;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.audiocn.model.PresentInfoModel;
import com.audiocn.poster.PresentsListDC;

public class PresentAdapter extends BaseAdapter {
	
	private Context mContext;
	private List<PresentInfoModel> mItems;
	
	public PresentAdapter(Context mContext, List<PresentInfoModel> mItems) {
		super();
		this.mContext = mContext;
		this.mItems = mItems;
	}

	@Override
	public int getCount() {
		return mItems.size();
	}

	@Override
	public Object getItem(int position) {
		return mItems.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		PresentsListDC pld;
		if(convertView == null){
			pld = new PresentsListDC(mContext, mItems.get(position));
		} else {
			pld = (PresentsListDC) convertView;
			pld.setPresentTitle(mItems.get(position).mtitle);
			pld.setPresentTime("接收礼品者"+mItems.get(position).msort+"       "+mItems.get(position).mtime);
		}
		return pld;
	}

}
